package stud.mpgame.net.userobject;

import org.apache.mina.core.buffer.IoBuffer;

import stud.mpgame.network.Message;
import stud.mpgame.network.UserObject;

import stud.mpgame.network.util.MessageUtils;

/**
 * @author f.pavel91@gmail.com
 * @version 1.0
 */
public class LoginUserObject extends UserObject {

    private String nickname;
    private int userID;

    @Override
    public void readExternal(IoBuffer buffer, Message owner) {
        nickname = MessageUtils.bytesToStr(buffer);
        userID = buffer.getInt();
    }

    @Override
    public String toString() {
        String result = "\n";
        result += "nickname: " + nickname + "\n";
        result += "UserID: " + userID + "\n";
        return result;
    }

}
